package ins.yan.framework.utils.string;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;

public class ReadStringFormFileUtil {

	public static void main(String[] args){
		String fileName="e:/1.xml";
		String str = readString(fileName);
		System.out.println(str);
	}
	
	public static String readString(String fileName){
		File file = new File(fileName);
		return readString(file);
	}
	
	public static String readString(File file){
		StringBuilder builder = new StringBuilder();
        if(!file.exists())
        { 
            System.err.println("Can't Find " + file);
        }

        try 
        {
            BufferedReader in = new BufferedReader(new FileReader(file));
            String str;
            while ((str = in.readLine()) != null) 
            {
                  //System.out.println(str);
                  builder.append(str);
            }
            in.close();
        } 
        catch (IOException e) 
        {
            e.getStackTrace();
        }
		return builder.toString();
	}
}
